package com.se.day19;

import java.time.LocalDateTime;

public class Order {
	
	private static long index = 0;
	
	private long id;
	
	private String ordNo;
	
	private double cost;
	
	private LocalDateTime orderTime;
	
	private LocalDateTime shippedTime;
	
	private OrderStatus status;

	/**
	 * @param ordNo
	 * @param cost
	 * @param status
	 */
	public Order(String ordNo, double cost, OrderStatus status, LocalDateTime shippedTime) {
		this.id = ++index;
		this.ordNo = ordNo;
		this.cost = cost;
		this.status = status;
		this.orderTime = LocalDateTime.now();
		this.shippedTime = shippedTime;
	}

	/**
	 * @return the index
	 */
	public static long getIndex() {
		return index;
	}

	/**
	 * @param index the index to set
	 */
	public static void setIndex(long index) {
		Order.index = index;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the ordNo
	 */
	public String getOrdNo() {
		return ordNo;
	}

	/**
	 * @param ordNo the ordNo to set
	 */
	public void setOrdNo(String ordNo) {
		this.ordNo = ordNo;
	}

	/**
	 * @return the cost
	 */
	public double getCost() {
		return cost;
	}

	/**
	 * @param cost the cost to set
	 */
	public void setCost(double cost) {
		this.cost = cost;
	}

	/**
	 * @return the orderTime
	 */
	public LocalDateTime getOrderTime() {
		return orderTime;
	}

	/**
	 * @param orderTime the orderTime to set
	 */
	public void setOrderTime(LocalDateTime orderTime) {
		this.orderTime = orderTime;
	}

	/**
	 * @return the shippedTime
	 */
	public LocalDateTime getShippedTime() {
		return shippedTime;
	}

	/**
	 * @param shippedTime the shippedTime to set
	 */
	public void setShippedTime(LocalDateTime shippedTime) {
		this.shippedTime = shippedTime;
	}

	/**
	 * @return the status
	 */
	public OrderStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(OrderStatus status) {
		this.status = status;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Order [id=").append(id).append(", ordNo=").append(ordNo).append(", cost=").append(cost)
				.append(", orderTime=").append(orderTime).append(", shippedTime=").append(shippedTime)
				.append(", status=").append(status).append("]");
		return builder.toString();
	}
	
}
